from __future__ import annotations

from sqlalchemy.ext.asyncio import AsyncSession

from app.db.session import async_session_factory


async def get_db() -> AsyncSession:
  async with async_session_factory() as session:
    try:
      yield session
    finally:
      await session.close()
